define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {

    var Controller = {
        index: function () {

            var barChart = Echarts.init(document.getElementById('simplebar-chart'));
            option = {
                xAxis: {
                    trigger: 'axis',
                    type: 'category',
                    axisLine: {
                        lineStyle: {
                            color: "#7266ba",
                            with:3000,
                        }
                    },
                    //data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                    data: Config.roomcolumn,
                },
                yAxis: {
                    trigger: 'axis',
                    type: 'value',
                    axisLine: {
                        lineStyle: {
                            color: "#7266ba",
                            with:300,
                        }
                    }
                },
                series: [{
                    trigger: 'axis',
                    //data: [120, 200, 150, 80, 70, 110, 130],
                    data: Config.roomdata,
                    type: 'bar',
                    itemStyle: {
                        color: "#7266ba",
                        opacity: 0.6
                    }
                }]
            };
            // 使用刚指定的配置项和数据显示图表。
            barChart.setOption(option);


            var barChart2 = Echarts.init(document.getElementById('simplebar-chart2'));
            option = {
                xAxis: {
                    type: 'category',
                    axisLine: {
                        lineStyle: {
                            color: "#27C24C"
                        }
                    },
                    data: Config.contractcolumn,
                },
                yAxis: {
                    type: 'value',
                    axisLine: {
                        lineStyle: {
                            color: "#27C24C"
                        }
                    }
                },
                series: [{
                    data: Config.contractdata,
                    type: 'bar',
                    itemStyle: {
                        color: "#27C24C",
                        opacity: 0.6
                    }
                }]
            };
            // 使用刚指定的配置项和数据显示图表。
            barChart2.setOption(option);


            $(window).resize(function () {
                myChart.resize();
            });

            $(document).on("click", ".btn-refresh", function () {
                setTimeout(function () {
                    myChart.resize();
                }, 0);
            });

        }
    };

    return Controller;
});
